#$Id: PKGBUILD 88577 2013-04-20 14:52:33Z dwallace $
# Maintainer: Daniel Wallace <danielwallace at gtmanfred dot com>
# Contributor: Lucas De Marchi <lucas.de.marchi@gmail.com>

pkgname=connman
pkgver=1.13
pkgrel=1
pkgdesc="Wireless LAN network manager"
url="http://connman.net/"
arch=('i686' 'x86_64')
license=('GPL2')
depends=('dbus-core' 'iptables' 'glib2' 'gnutls')
conflicts=('openresolv')
optdepends=('bluez: Support for Bluetooth devices'
            'wpa_supplicant: For WiFi devices')
makedepends=('bluez' 'wpa_supplicant' 'openconnect' 'openvpn')
options=('!libtool')
source=("http://www.kernel.org/pub/linux/network/${pkgname}/${pkgname}-${pkgver}.tar.bz2"
        'allow_group_network.diff')
md5sums=('12c0d5a52ad3749afac260ebc7151d16'
         'a8d22ee089fb0ed725130d16ad393047')

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  patch -Np1 -i "${srcdir}/allow_group_network.diff"

  ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
      --with-systemdunitdir=/usr/lib/systemd/system \
      --enable-threads \
      --enable-openconnect \
      --enable-vpnc \
      --enable-openvpn \
      --enable-polkit \
      --enable-client

  make
}

package(){
  make -C "${srcdir}/${pkgname}-${pkgver}" DESTDIR="${pkgdir}" install
  install -Dm755 "$srcdir/$pkgname-$pkgver/client/${pkgname}ctl" "$pkgdir/usr/sbin/${pkgname}ctl"
}
